package org.mall.modules.product.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.mall.common.api.vo.Result;
import org.mall.modules.pojo.product.vo.ParamVo;
import org.mall.modules.product.entities.CommoditySku;
import org.mall.modules.product.entities.CommoditySpu;
import org.mall.modules.product.entities.ProductMsg;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 商品SPU
 * @Author: jeecg-boot
 * @Date:   2019-11-07
 * @Version: V1.0
 */
public interface ICommoditySpuService extends IService<CommoditySpu> {

	/**
	 * 添加一对多
	 * 
	 */
	 void saveMain(CommoditySpu spu, List<CommoditySku> skuList) ;
	
	/**
	 * 修改一对多
	 * 
	 */
	 void updateMain(CommoditySpu spu, List<CommoditySku> itemMainList);

	/**
	 * 删除一对多--更新
	 * @param id
	 */
	 void delOneMain(Long id);

	/**
	 * 批量删除一对多--更新
	 * @param idList
	 */
	 void delListBatchMain(Collection<? extends Serializable> idList);
	/**
	 * 管理端分页查询商品SPU、SKU
	 */
	IPage<ProductMsg> findByPage(Page page, @Param(Constants.WRAPPER) QueryWrapper<CommoditySpu> queryWrapper);

    boolean judgeIsVisible(String ids);


    boolean changeProductSpuVisible(Long spuId, Boolean visible);


    boolean batchChangeProductSpuVisible(Collection<Long> spuIds, Boolean visible);


    boolean toExamineGoods(Long id, Integer status);

    boolean batchToExamineGoods(Collection<Long> spuIds, String toExamine);

    /**
	 * 管理端删除商品
	 * @param paramVo
	 * @return
	 */
	Result<?> delete(ParamVo paramVo);

	ProductMsg  getOneShopDetails(Long id);



    /**
     * 通过spuids获取多个商品的信息
     * @param spuIds
     * @return
     */
    List<ProductMsg> getGoodsList(List<Long> spuIds);

    /**
     * 取某个店铺的所有商品
     * @param page
     * @param queryWrapper
     * @return
     */
    IPage<CommoditySpu> pageList(Page page, QueryWrapper<CommoditySpu> queryWrapper);
	IPage<CommoditySpu> getShopPageListOfShop(Page page, String shopId,String entryId);

	IPage<CommoditySpu> getAppShopPageListOfShop(Page page, String shopId, String entryId);

	/**
     * 判断商品审核状态 true :通过 false: 未通过
     * @param spuId
     * @return
     */
    Boolean judgeToExamine(String spuId);

    ProductMsg getOneShopDetailsBySkuId(Long id);

    /**
     * 通过商品id 获取对应的商户id
     * @param asList
     * @return
     */
    List<ProductMsg> getAllSellerId(List<String> asList);

	Integer getProductCount();

    String getSellerId(String shopId);

	List<CommoditySpu> getSpuList(List<Long> collect);
}
